class Vehicle(object):
    def __init__(self, wheels, weight):
        self.set_wheels(wheels)
        self.set_weight(weight)

    def set_weight(self, weight):
        if not isinstance(weight, float):
            raise ValueError("数据应该是带小数点的格式")
        if weight < 0:
            raise ValueError("重量应该是一个大于0的数")
        self._weight = weight

    def get_weight(self):
        return self._weight

    def set_wheels(self, wheels):
        if not isinstance(wheels, int):
            raise ValueError("数据应该是整数")
        if wheels < 4:
            raise ValueError("数据应该大于4")
        self._wheels = wheels

    def get_wheels(self):
        return self._wheels

    def display(self):
        print('车轮数：' + str(self.get_wheels()) + '个', '重量：' + str(self.get_weight()) + '吨')


class Car(Vehicle):
    def __init__(self, wheels, weight, passenger_load = 4):
        super(Car, self).__init__(wheels, weight)
        self.set_passenger_load(passenger_load)

    def get_passenger_load(self):
        return self._passenger_load

    def set_passenger_load(self, passenger_load):
        self._passenger_load = passenger_load

    def display(self):
        super(Car, self).display()
        print('载客数：' + str(self.get_passenger_load()) + '人')


class Truck(Vehicle):
    def __init__(self, wheels, weight, passenger_load, payload):
        super(Truck, self).__init__(wheels, weight)
        self.set_passenger_load(passenger_load)
        self.set_payload(payload)

    def get_payload(self):
        return self._payload

    def set_payload(self, payload):
        self._payload = payload

    def get_passenger_load(self):
        return self._passenger_load

    def set_passenger_load(self, passenger_load):
        self._passenger_load = passenger_load

    def display(self):
        super(Truck, self).display()
        print('载客数：' + str(self.get_passenger_load()) + '人', '载重量：' + str(self.get_payload()) + '吨')


print('汽车：')
v = Vehicle(4, 1.0)
v.display()
print('小汽车：')
c = Car(4, .5)
c.display()
print('卡车：')
t = Truck(12, 3.0, 6, 10)
t.display()
